<?php 
$GLOBALS['Md'] = "Clients";
$GLOBALS['Pd'] = "N";
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
require_once($GLOBALS['BIB']."Objects/obj.mssql.php");
print heade(); 
print body(); 
module($BSD['DB00']); 
office_header($_SESSION[$SESSOF]);
include($GLOBALS['PAD']."Modules/Clients/nav.views.php");
print NavFront();
?>
<div id="Centro" class="strcture">
<?php
include($GLOBALS['PAD']."Modules/Clients/main.obj.php");
?>

<table width="100%"  border="0" cellpadding="4" cellspacing="2">
  <tr>
    <td><table width="100%"  border="0" cellpadding="10" cellspacing="1">
      <tr bgcolor="#009999">
        <td colspan="3">Contacto ao Cliente </td>
      </tr>
    </table> </td>
  </tr>
  <tr>
    <td>Resultados      
	<table width="100%"  border="0" cellpadding="2" cellspacing="1">
          <tr>
            <td colspan="2">Pergunta: 
			<?php
			$QUE = $GLOBALS['CONN']->db_array('SELECT REF, TEXT FROM outbound_questions');
			print $QUE[1]['TEXT']; ?></td>
          </tr>
			<?php
			$QUE = $GLOBALS['CONN']->db_array("SELECT REF, NAME FROM outbound_values WHERE QUESTION = {$QUE[1]['REF']}");
			$QUER = $GLOBALS['CONN']->db_array("SELECT COUNT(VALUE) AS NUM FROM outbound WHERE QUESTION = {$QUE[1]['REF']}
			GROUP BY VALUE ORDER BY VALUE ASC");
			$t = 0;
			for ($r = 1; $r <= $QUER[0]; $r++) {
			if (isset($QUER[$r])) {
			$t = $t+$QUER[$r]['NUM'];
			}
			}
			for ($r = 1; $r <= $QUE[0]; $r++) {
			if (isset($QUER[$r])) {
			$wid = $QUER[$r]['NUM']/$t*100;
			} else {
			$wid  = 0;
			}
	echo '<tr bgcolor="#F2F2F2">
            <td width="40%">'.$QUE[$r]['NAME'].'</td><td width="60%"><img src="'.$GLOBALS['GFX'].'DynGraphs\bar.gif" width='.($wid*5).' height="10"> ('.$wid.'%)</td>
        </tr>';
			}?>
      </table>
	</td>
  </tr>
</table>
</div>
<?php echo footer(); ?>